import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';
import { AlbumService } from './album.service';
import { CreateAlbumDto } from './dto/create-album.dto';
import { AboutAPI, API } from '../../types';

@Controller('album')
export class AlbumController {
  constructor(private readonly albumService: AlbumService) {}

  @Post('/create')
  create(@Body() BodyData: CreateAlbumDto) {
    return this.albumService.create(BodyData);
  }

  @Get('/findAll')
  findAll(@Query() paramData: API.paging & AboutAPI.aboutTableSearch) {
    console.log(paramData);
    return this.albumService.findAll(paramData);
  }

  @Get('/getInfo')
  findOne(@Query('id') id: string) {
    return this.albumService.findOne(id);
  }

  @Delete('/delete')
  remove(@Body('id') id: string) {
    return this.albumService.remove(id);
  }
}
